readline: add unicode line separator option#63789
Open
scarab-systems wants to merge 1 commit into
Open
Conversation
Signed-off-by: Scarab Systems <scarab.systems@yahoo.com>
90cb9fa to
d936651
Compare
aduh95
reviewed
Jun 8, 2026
Comment on lines
+725
to
+726
| * `unicodeLineSeparators` {boolean} If `true`, `\u2028` and `\u2029` will be | ||
| treated as end-of-line input. **Default:** `true`. |
Contributor
There was a problem hiding this comment.
I wonder if a boolean is the correct way, or if we should instead let the user define their own list of separator as suggested in #60606 (comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #22448
This adds a
unicodeLineSeparatorsoption toreadline.createInterface()andreadlinePromises.createInterface().By default, behavior is unchanged:
\u2028and\u2029continue to be treated as line endings. WhenunicodeLineSeparators: falseis passed, readline only splits on CR, LF, and CRLF, allowing formats such as JSONL to preserve Unicode line and paragraph separators inside record contents.Tests added/updated:
./node test/parallel/test-readline-line-separators.jspython3 tools/test.py --shell ./node test/parallel/test-readline-line-separators.jsmake lint-js LINT_JS_TARGETS="lib/internal/readline/interface.js lib/readline.js test/parallel/test-readline-line-separators.js"make lint-md LINT_MD_FILES="doc/api/readline.md"